/*
 * @Author: wangming
 * @Date: 2021-04-16 18:07:06
 * @LastEditors: wangming
 * @LastEditTime: 2022-05-11 16:31:55
 * @Description: 表单操作按钮
 */
export default {
  render() {
    let button;
    const buttonType = this.$attrs.type;
    if (buttonType === "delete") {
      button = (
        <el-button
          type="text"
          size="small"
          class="link-danger"
          slot="reference"
        >
          {Object.keys(this.$slots).map((name) => (
            <template slot={name}>{this.$slots[name]}</template>
          ))}
        </el-button>
      );
    } else if (buttonType === "info-button") {
      button = (
        <el-button type="text" size="small" class="info-button">
          {Object.keys(this.$slots).map((name) => (
            <template slot={name}>{this.$slots[name]}</template>
          ))}
        </el-button>
      );
    } else if (buttonType === "success") {
      button = (
        <el-button type="text" size="small" class="success-button">
          {Object.keys(this.$slots).map((name) => (
            <template slot={name}>{this.$slots[name]}</template>
          ))}
        </el-button>
      );
    } else if (buttonType === "warning") {
      button = (
        <el-button type="text" size="small" class="warning-button">
          {Object.keys(this.$slots).map((name) => (
            <template slot={name}>{this.$slots[name]}</template>
          ))}
        </el-button>
      );
    } else if (buttonType === "danger") {
      button = (
        <el-button type="text" size="small" class="danger-button">
          {Object.keys(this.$slots).map((name) => (
            <template slot={name}>{this.$slots[name]}</template>
          ))}
        </el-button>
      );
    } else {
      button = (
        <el-button type="text" size="small" disabled={false}>
          {Object.keys(this.$slots).map((name) => (
            <template slot={name}>{this.$slots[name]}</template>
          ))}
        </el-button>
      );
    }
    return <span class="dib table-actionItem">{button}</span>;
  },
};
